<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
	
	<h:head>
		<title>User list</title>
	</h:head>
	
	
	<h:body>
		
		<h:messages />
		
		<a href="user_edit.xhtml">Add user</a>
		
		<h:dataTable border="1" var="user" value="#{index.users}">
			<h:column>
				<f:facet name="header">ID</f:facet>
	   			#{user.id}
	   		</h:column>
			<h:column>
				<f:facet name="header">First name</f:facet>
	   			#{user.firstName}
	   		</h:column>
			<h:column>
				<f:facet name="header">Last name</f:facet>
	   			#{user.lastName}
	   		</h:column>
			<h:column>
				<f:facet name="header">Email</f:facet>
	   			#{user.email}
	   		</h:column>
	   		<h:column>
				<f:facet name="header">Birthday</f:facet>
				<h:outputLabel value="#{user.birthday}">
					<f:convertDateTime pattern="dd-MM-yyyy"/>
				</h:outputLabel>	   			
	   		</h:column>
	   		<h:column>
				<f:facet name="header">Edit</f:facet>
	   			<h:link outcome="user_edit.xhtml" value="Edit user">
	   				<f:param name="user" value="#{user.id}"/>
	   			</h:link>
	   		</h:column>
	   		<h:column>
	   			<f:facet name="header">Delete</f:facet>
	   			<h:link outcome="user_delete.xhtml" value="Delete user">
	   				<f:param name="user" value="#{user.id}" />
	   			</h:link>
	   		</h:column>	
		</h:dataTable>
		
	</h:body>
</html>